﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using DarkAngels.WoW.Library.Interfaces;
using System.Xml;

namespace DarkAngels.WoW.Library.Armory
{
    public abstract class AbstractDataClass : IDataClass
    {
        #region IDataClass Members

        public INetworking Provider
        {
            get;
            set;
        }

        public ArmoryRegion Region
        {
            get;
            set;
        }

        #endregion

        public String BuildUri(String fileName)
        {
            string finalUri = String.Format("[BASE]/{0}", fileName);
            switch (Region)
            {
                case ArmoryRegion.EU:
                    finalUri = finalUri.Replace("[BASE]", "http://eu.wowarmory.com");
                    break;
                case ArmoryRegion.US:
                    finalUri = finalUri.Replace("[BASE]", "http://www.wowarmory.com");
                    break;
                case ArmoryRegion.KR:
                    finalUri = finalUri.Replace("[BASE]", "http://kr.wowarmory.com");
                    break;
                case ArmoryRegion.TW:
                    finalUri = finalUri.Replace("[BASE]", "http://tw.wowarmory.com");
                    break;
                case ArmoryRegion.CN:
                    finalUri = finalUri.Replace("[BASE]", "http://cn.wowarmory.com");
                    break;
                default:
                    finalUri = finalUri.Replace("[BASE]", "http://eu.wowarmory.com");
                    break;
            }
            finalUri = finalUri.Replace(' ', '+');
            return finalUri;
        }

        /// <summary>
        /// Lets you load data from the network at will.
        /// You have to call Load() when you need the data, as it will not be called on it's own.
        /// </summary>
        public abstract void Load();
    }
}
